local sk__yingcai = fk.CreateSkill {

  name = "sk__yingcai",

  tags = {  },

}



sk__yingcai:addEffect(fk.EventPhaseStart, {
  name = "sk__yingcai",
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__yingcai.name) and player.phase == Player.Draw
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards, suits = {}, {}
    while #suits < 3 do
      local card = room:getNCards(1)[1]
      table.insert(cards, card)
      room:moveCardTo(card, Card.Processing, nil, fk.ReasonJustMove, sk__yingcai.name, nil, true, player)
      local suit = Fk:getCardById(card).suit
      if suit ~= Card.NoSuit then
        table.insertIfNeed(suits, suit)
        if #suits < 3 then
          room:setCardEmotion(card, "judgegood")
        else
          room:setCardEmotion(card, "judgebad")
          break
        end
      end
      room:delay(800)
    end
    room:delay(800)
    room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonJustMove, sk__yingcai.name, nil, true, player)
    return true
  end,
})

return sk__yingcai